"It can be used only by extensions.gnome.org"
#define PLUGIN_MIME_STRING "application/x-gnome-shell-integration::Gnome Shell Integration Dummy Content-Type";
-#define PLUGIN_API_VERSION 2
+#define PLUGIN_API_VERSION 3
typedef struct {
GDBusProxy *proxy;
static NPIdentifier onextension_changed_id;
static NPIdentifier onrestart_id;
static NPIdentifier get_errors_id;
+static NPIdentifier launch_extension_prefs_id;
static bool
plugin_object_has_method (NPObject *npobj,
name == enable_extension_id ||
name == install_extension_id ||
name == uninstall_extension_id ||
- name == get_errors_id);
+ name == get_errors_id ||
+ name == launch_extension_prefs_id);
}
static inline gboolean
return jsonify_variant (res, result);
}
+static gboolean
+plugin_launch_extension_prefs (PluginObject *obj,
+ NPString uuid,
+ NPVariant *result)
+{
+ gchar *uuid_str;
+
+ uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
+ if (!uuid_is_valid (uuid_str))
+ {
+ g_free (uuid_str);
+ return FALSE;
+ }
+
+ g_dbus_proxy_call (obj->proxy,
+ "LaunchExtensionPrefs",
+ g_variant_new ("(s)", uuid_str),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, /* timeout */
+ NULL, /* cancellable */
+ NULL, /* callback */
+ NULL /* user_data */);
+
+ g_free (uuid_str);
+ return TRUE;
+}
+
static int
plugin_get_api_version (PluginObject *obj,
NPVariant *result)
NPVARIANT_TO_STRING(args[0]),
result);
}
+ else if (name == launch_extension_prefs_id)
+ {
+ if (!NPVARIANT_IS_STRING(args[0])) return FALSE;
+
+ return plugin_launch_extension_prefs (obj,
+ NPVARIANT_TO_STRING(args[0]),
+ result);
+ }
return TRUE;
}
install_extension_id = funcs.getstringidentifier ("installExtension");
uninstall_extension_id = funcs.getstringidentifier ("uninstallExtension");
get_errors_id = funcs.getstringidentifier ("getExtensionErrors");
+ launch_extension_prefs_id = funcs.getstringidentifier ("launchExtensionPrefs");
onrestart_id = funcs.getstringidentifier ("onshellrestart");
onextension_changed_id = funcs.getstringidentifier ("onchange");
const Lang = imports.lang;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
+const Shell = imports.gi.Shell;
const Config = imports.misc.config;
const ExtensionSystem = imports.ui.extensionSystem;
<arg type="s" direction="in" name="uuid"/>
<arg type="b" direction="out" name="success"/>
</method>
+<method name="LaunchExtensionPrefs">
+ <arg type="s" direction="in" name="uuid"/>
+</method>
<property name="OverviewActive" type="b" access="readwrite" />
<property name="ApiVersion" type="i" access="read" />
<property name="ShellVersion" type="s" access="read" />
case 'number':
type = 'd';
break;
+ case 'boolean':
+ type = 'b';
+ break;
default:
continue;
}
return ExtensionSystem.uninstallExtensionFromUUID(uuid);
},
+ LaunchExtensionPrefs: function(uuid) {
+ let appSys = Shell.AppSystem.get_default();
+ let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
+ app.launch(global.display.get_current_time_roundtrip(),
+ ['extension:///' + uuid], -1, null);
+ },
+
get OverviewActive() {
return Main.overview.visible;
},